package com.ktjy.sample.factory;

import com.ktjy.sample.dao.PetDao;
import com.ktjy.sample.dao.PetDaoImpl;
import com.ktjy.sample.dao.PetDaoOracleImpl;

public class PetDaoFactory {
    public static String defaultBeanName="MySql";

    public static PetDao getPetDao(String defaultBeanName){
        PetDao petDao = null;
        switch (defaultBeanName){
            case "MySql":
                petDao = new PetDaoImpl();
                break;
            case "Oracle":
                petDao = new PetDaoOracleImpl();
                break;
            default:
                throw new RuntimeException("没有此数据源");
        }
        return petDao;
    }
}
